const path = require("path");
const { Tray, Menu, nativeImage } = require("electron");

let appTray = null;

module.exports = (win) => {
  const icon = nativeImage.createFromPath(
    path.join(__dirname, "./assets/favicon.ico")
  );
  appTray = new Tray(icon);

  const contextMenu = Menu.buildFromTemplate([
    { label: "设置", role: "", type: "normal" },
    { label: "意见反馈", role: "", type: "normal" },
    { label: "帮助", role: "help", type: "normal" },
    { label: "关于LL", role: "about", type: "normal" },
    { label: "退出LL", role: "quit", type: "normal" },
  ]);

  appTray.on("click", () => {
    win.show();
  });

  appTray.setContextMenu(contextMenu);
  appTray.setToolTip("LL");
  appTray.setTitle("LL");
};
